<template>
  <div class="app-container">
    <div class="block">
      <div class="title">项目详情</div>
      <el-divider></el-divider>
      <el-descriptions class="margin-top" :column="3" border>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            项目名称
          </template>
          李四
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-mobile-phone"></i>
            项目编号
          </template>
          2104623
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            位置
          </template>
          拱墅区
        </el-descriptions-item>

        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-office-building"></i>
            项目负责人
          </template>
          李响
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            分配时间
          </template>
          2023-12-24 16:10:10
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            项目状态
          </template>
          进行中
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            备注
          </template>
          11111
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            关联图纸
          </template>
          <div class="logo-container">
            <img src="@/assets/images/pdf.png" alt="" class="logo" />
            <span>查看图纸</span>
          </div>
        </el-descriptions-item>
      </el-descriptions>

      <div class="title">施工计划</div>
      <el-divider></el-divider>
      <div style="float:right;margin:10px 0">
        <el-button size="mini" type="primary" @click="addProject"
          >新增</el-button
        >
        <el-button size="mini" type="success" @click="edit(item)"
          >修改</el-button
        >
        <el-button size="mini" type="danger" @click="del(item)">删除</el-button>
      </div>
      <!-- <el-timeline>
        <el-timeline-item
          v-for="(item, index) in projectLine"
          :key="index"
          :timestamp="item.date"
          placement="top"
        >
          <el-card>
          <h4>{{ item.detail }}</h4>
          <div v-if="item.ability" class="ability-container">
            <span style="margin-right: 20px">能力：{{ item.ability }}</span>
            <img src="@/assets/images/pdf.png" alt="" class="logo" />
            <span>评估报告</span>
          </div>
          <div v-if="item.submitter" class="ability-container">
            提交人：{{ item.submitter }}
          </div>
          <div v-if="item.report" class="ability-container">
            <img src="@/assets/images/pdf.png" alt="" class="logo" />
            <span>方案报告</span>
          </div>
          <div v-if="item.transformDetail" class="ability-container">
            <span>{{ item.transformDetail }}</span>
          </div>
          <div v-if="item.consPersonnel" class="ability-container">
            <span>施工人员：{{ item.consPersonnel }}</span>
          </div>
          <div v-if="item.passImg" class="ability-container">
            <img :src="item.passImg" alt="" class="donelogo" />
          </div>
          </el-card>
        </el-timeline-item>
      </el-timeline>
      <div class="title">售后详情</div>

      <el-timeline>
        <el-timeline-item
          v-for="(item, index) in afterSalesLine"
          :key="index"
          :timestamp="item.date"
          placement="top"
        >
          <el-card>
            <h4>{{ item.detail }}</h4>
            <div v-if="item.consPersonnel" class="ability-container">
              <span>维护人员：{{ item.consPersonnel }}</span>
            </div>
          </el-card></el-timeline-item
        >
      </el-timeline> -->

      <el-steps align-center finish-status="success">
        <el-step
          v-for="(item, index) in projectLine"
          :key="index"
          :title="item.date"
        >
          <template slot="description">
            <div class="user" v-if="item.name">负责人：{{ item.name }}</div>
            <h4>{{ item.detail }}</h4>
            <!-- <el-button size="mini" type="success" @click="edit(item)"
              >修改</el-button
            >
            <el-button size="mini" type="danger" @click="del(item)"
              >删除</el-button
            > -->
          </template>
        </el-step>
      </el-steps>
      <div class="title">施工进度</div>
      <el-divider></el-divider>
      <el-steps
        :active="2"
        align-center
        finish-status="success"
        process-status="finish"
      >
        <el-step
          v-for="(item, index) in projectLine"
          :key="index"
          :title="item.date"
        >
          <template slot="description">
            <div class="user" v-if="item.name">
              负责人：{{ item.name }}
              <el-button type="text" size="small" v-if="index > 1"
                >更换</el-button
              >
            </div>
            <h4>{{ item.detail }}</h4>
            <div v-if="item.passImg" class="ability-container">
              <img :src="item.passImg" alt="" class="donelogo" />
            </div>
          </template>
        </el-step>
      </el-steps>
    </div>
    <el-dialog :visible.sync="dialogVisible" :title="title" width="500px">
      <el-form ref="form" :model="form" label-width="120px">
        <el-form-item label="时间">
          <el-date-picker
            type="date"
            placeholder="选择日期"
            v-model="form.date"
            style="width: 100%;"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="负责人">
          <el-input v-model="form.name" />
        </el-form-item>
        <el-form-item label="施工内容">
          <el-input v-model="form.detail" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="dialogVisible = false"
            >提交</el-button
          >
          <el-button @click="dialogVisible = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
export default {
  data() {
    return {
      /**
       * date 日期
       * detail 详情
       * ability 能力
       * abilityFile 能力评估文件pdf
       * submitter 提交人
       * report 方案报告pdf
       * transformDetail 改造详情
       */

      projectLine: [
        { date: "2023-7-5", detail: "拆除设备", name: "李洋" },
        {
          date: "2023-7-5",
          detail: "卫生间铺设防滑地砖",
          name: "李洋"
        },
        {
          date: "2023-7-6",
          detail: "卧室铺设防滑地胶",
          name: "李想"
        },
        {
          date: "2023-7-7",
          detail: "安装护理床，智能居家检测设备",
          name: "李丝"
        },
        {
          date: "2023-7-20",
          detail: "验收，交工"
          // passImg: require("@/assets/images/pass.png"),
        }
      ],
      status: "1",
      afterSalesLine: [
        {
          date: "2023-7-21",
          detail: "保养智能防走失装置",
          consPersonnel: "李响"
        },
        {
          date: "2023-7-22",
          detail: "保养智能防走失装置",
          consPersonnel: "李响"
        }
      ],
      dialogVisible: false,
      title: "新增",
      form: {}
    };
  },
  mounted() {},
  methods: {
    addProject() {
      this.dialogVisible = true;
      this.title = "新增计划";
    },
    edit(item) {
      this.dialogVisible = true;
      this.title = "修改计划";
      this.form = item;
    },
    change(item) {
      console.log(item);
    }
  }
};
</script>
<style scoped lang="scss">
.title {
  margin: 20px 0;
  padding: 8px;
  font-weight: 600;
  background-color: #cccccc62;
}
.operate {
  float: right;
  margin: 10px 0;
  .el-button {
    margin-right: 10px;
  }
}
.el-steps {
  clear: both;
}
.ability-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  .logo {
    width: 24px;
    height: 24px;
    // margin: 0 10px 0 0;
  }
  .donelogo {
    width: 44px;
    height: 44px;
  }
  //   span {
  //     margin-bottom: 10px;
  //   }
}
.user {
  font-weight: 600;
  color: #696868 !important;
}
.logo-container {
  display: flex;
  align-items: center;

  .logo {
    width: 24px;
    height: 24px;
  }
}
.el-button--small {
  padding: 0;
}
</style>
